{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "918855f8-f814-4f28-9b46-969b52deb20f",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/find-peak-element\n",
    "\n",
    "\n",
    "Runtime: 0 ms, faster than 100.00% of Go online submissions for Find Peak Element.\n",
    "Memory Usage: 2.8 MB, less than 100.00% of Go online submissions for Find Peak Element.\n",
    "\n",
    "\n",
    "\n",
    "```go\n",
    "package main\n",
    "\n",
    "import (\n",
    "\t\"math\"\n",
    ")\n",
    "\n",
    "func findPeakElement(nums []int) int {\n",
    "\t//7:09\n",
    "\tvar max_value = int(math.Inf(-1))\n",
    "\tvar possible_index = 9\n",
    "\tfor i, n := range nums {\n",
    "\t\tif n > max_value {\n",
    "\t\t\tpossible_index = i\n",
    "            max_value = n\n",
    "\t\t}\n",
    "\t\tif i != 0 && i < len(nums)-1 {\n",
    "            if nums[i-1] < n && n > nums[i+1] {\n",
    "                return i\n",
    "            }\n",
    "\t\t}\n",
    "\t}\n",
    "\treturn possible_index\n",
    "\t//7:15\n",
    "}\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2d9b09d1-b786-41e0-8cfe-06becb57bbb0",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Go",
   "language": "go",
   "name": "gophernotes"
  },
  "language_info": {
   "codemirror_mode": "",
   "file_extension": ".go",
   "mimetype": "",
   "name": "go",
   "nbconvert_exporter": "",
   "pygments_lexer": "",
   "version": "go1.14.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
